/*-------------------------------------------------------------------------

***************** Modification History ***********************************
   @doc
   @module Card.h - Header file for Card account number entry functionality |
   @end
   
$Log: /SoftPay/SPK2SIM/Source/Include/card.h $ 

**************************************************************************

   Copyright (C) 1999 by VeriFone, Inc.

   All rights reserved.  No part of this software may be reproduced,
   transmitted, transcribed, stored in a retrieval system, or translated
   into any language or computer language, in any form or by any means,
   electronic, mechanical, magnetic, optical, chemical, manual or otherwise,
   without the prior written permission of VeriFone, Inc.

---------------------------------------------------------------------------*/
#ifndef VSCARD_H
#define VSCARD_H

#include <transact.h>
#include <define.h>

extern int hCardReader;

#define TRACK_ONE_MASK     1
#define TRACK_TWO_MASK     2
#define BOTH_TRACKS_MASK   (TRACK_ONE_MASK | TRACK_TWO_MASK)

#define	READ_CARD_MANUAL	1
#define	READ_CARD_SWIPED	2
#define	READ_CARD_EITHER	(READ_CARD_MANUAL | READ_CARD_SWIPED)

int inCheckCardSwipe(void);
#define CHK_CARD_RDR()     (inCheckCardSwipe())

/* Banning Card Types */
#define TRT_CREDIT_CARD            0x0001
#define TRT_DEBIT_CARD             0x0002
#define TRT_PURCHASE_CARD          0x0004
#define TRT_ADMIN_CARD             0x0008
#define TRT_NON_CARD               0x0010
#define TRT_EBT_CARD               0x0020
#define TRT_LOYALTY_CARD           0x0040
#define TRT_LOYCREDIT_CARD         0x0080
#define TRT_FLEET_CARD			   0x0100
#define TRT_EMV_CARD               0x0200

#define TRT_FINANCIAL_CARDS		   TRT_CREDIT_CARD | TRT_DEBIT_CARD | TRT_PURCHASE_CARD |TRT_EBT_CARD | TRT_FLEET_CARD
#define TRT_LOYALTY_CARDS		   TRT_LOYALTY_CARD | TRT_LOYCREDIT_CARD
#define TRT_DEBIT_EBT_CARD         TRT_DEBIT_CARD | TRT_EBT_CARD
#define TRT_DEBIT_EBT_PURCH_CARD   TRT_DEBIT_CARD | TRT_EBT_CARD | TRT_PURCHASE_CARD
#define TRT_NON_EBT_CARDS          ~TRT_EBT_CARD

int inAddCardFunctions(void);
int inGetCardBin (TRANSACTION_OBJECT *pobTran, char *pchCardNum, unsigned fManual);
int inValidateManualExpDate (char *pchExpDate);
int inValidateManualCardNo (TRANSACTION_OBJECT *pobTran, char *pchAcctNum);
int inValidateSwipedCard (TRANSACTION_OBJECT *pobTran);
int inValidateICCCard (TRANSACTION_OBJECT *pobTran);
void vdDetermineCardType (TRANSACTION_OBJECT *pobTran, struct TRACK *psrCardData);
int inValInteracDebit (TRANSACTION_OBJECT *pobTran, struct TRACK *psrCardData);
VS_BOOL fFPSQualified(TRANSACTION_OBJECT *pobTran);
int inValidateCardEntryMethod (TRANSACTION_OBJECT *pobTran);
int inFraudControl(TRANSACTION_OBJECT *pobTran);
int inFC_ConfirmLast4(TRANSACTION_OBJECT *pobTran);
int inFC_ConfirmDisplay(TRANSACTION_OBJECT *pobTran);
int inFC_ConfirmBoth(TRANSACTION_OBJECT *pobTran);
int inValidateLast4Digits(char *pchAccount);
int inFastPayFlow(TRANSACTION_OBJECT *pobTran);
int inSaleCardPresent(TRANSACTION_OBJECT *pobTran);
int inEnterCardData (TRANSACTION_OBJECT *pobTran);
int inImprintCardConfirm(TRANSACTION_OBJECT *pobTran);
int CARD_CODE_CHECK(char * a,char *b,short *  c,char * d,unsigned char * e);
int inGetCVV2 (TRANSACTION_OBJECT *pobTran);
extern int inStartCardTxn (TRANSACTION_OBJECT *pobTran);
extern int inManualEntryProcess (TRANSACTION_OBJECT *pobTran, PFI pinValManual, int *pinResult);
extern int inCardReadOperation (TRANSACTION_OBJECT *pobTran, PFI pinValSwiped, int *pinResult);
extern int inDisplaySwipeCardInfo (TRANSACTION_OBJECT *pobTran);
extern int inDisplayCardTitle (TRANSACTION_OBJECT *pobTran);
// static int inSetCustomFPSPrintOption(TRANSACTION_OBJECT *pobTran);
int inDefaultFPSPrintOptionFunction (TRANSACTION_OBJECT *pobTran);
int inCheckExpDate(char *pchExpDate);
int inManualExpDate(TRANSACTION_OBJECT *pobTran);

#endif
